﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SCG.General;

namespace TTEngine
{
    public class ClimbTarget : MapObject
    {
        //object name
        public override string ObjectName
        {
            get
            {
                if (Level == null)
                    return "Pit";
                char c = Level.TerrainMap.Get(X, Y);
                return c.TerrainDescription().ToProper();
            }
        }

        //clone
        public override MapObject Clone()
        {
            return new ClimbTarget();
        }

        //no image
        public override Bitmap Image
        {
            get
            {
                return null;
            }
        }

        //allow climb
        public override List<string> GetActionsAdjacent(Actor actor)
        {
            int l1 = Level.TerrainLevel(actor.X, actor.Y);
            int l2 = Level.TerrainLevel(X, Y);
            List<string> actions = base.GetActionsAdjacent(actor);
            if (l2 > l1)
                actions.Add("Climb Up");
            else
                actions.Add("Climb Down");
            return actions;
        }

        //process climb
        public override void ProcessAdjacentAction(Actor actor, string action, int qty)
        {
            switch (action)
            {
                case "Climb Up":
                case "Climb Down":
                    {
                        actor.DestX = X;
                        actor.DestY = Y;
                        actor.Orders = OrderType.Climb;
                        Level.Host.ShuffleSprite(actor, X, Y);
                        break;
                    }
                default:
                    {
                        base.ProcessAdjacentAction(actor, action, qty);
                        break;
                    }
            }
        }
    }
}
